package com.bzoa.api.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bzoa.api.dto.MenuDTO;
import com.bzoa.api.entity.Menu;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lands
 * @Date 2023/3/20 10:45
 * @Description TODO
 */
public interface MenuMapper extends BaseMapper<Menu> {
       @Select("select  distinct " +
               "        a.menu_id," +
               "        a.menu_name," +
               "        a.menu_url," +
               "        a.parent_id," +
               "        a.menu_sort," +
               "        a.description," +
               "        a.menu_icon" +
               "       FROM bz_menu  a" +
               "       where  a.parent_id is null or a.parent_id=0" +
               "       order  by a.menu_sort asc")
       List<MenuDTO> listProduct();
       @Select("      select  distinct" +
               "        a.menu_id," +
               "        a.menu_name," +
               "        a.menu_url," +
               "        a.parent_id," +
               "        a.menu_sort," +
               "        a.description," +
               "        a.menu_icon" +
               "       FROM   bz_menu  a" +
               "       where  a.parent_id=#{id}" +
               "       order  by a.menu_sort asc")
       List<MenuDTO> listProductById(String id);
}

